package com.superm.controller;

import com.superm.entity.GodownEntryPoJo;
import com.superm.entity.RepostoryType;
import com.superm.service.GodownEntryService;
import com.superm.service.RepostoryService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

/**
 *  采购入库单控制器
 */
@RequestMapping("/godownEntry")
@Controller
public class GodownEntryController {


    @Autowired
    private GodownEntryService godownEntryService;

    @Autowired
    private RepostoryService repostoryService;
    /**
     * 跳转到入库单查询
     * @return
     */
    @RequestMapping("/skipShowGodownEntry")
    public ModelAndView skipShowGodownEntry(){
        ModelAndView mv = new ModelAndView("godownEntry/showdownentry");
        //查询所有仓库
        List<RepostoryType> repostoryTypes =  repostoryService.allRepostory();
        mv.addObject("repostoryTypes",repostoryTypes);
        return mv;
    }


    /**
     * 模糊查询采购入库单
     * @return
     */
    @RequestMapping("/likeGodownEntry")
    @ResponseBody
    public Map<String,Object> likeGodownEntry(GodownEntryPoJo godownEntryPoJo, @RequestParam("page") Integer pageNo,@RequestParam("limit")Integer pageSize){
        Map<String,Object> map =  godownEntryService.likeGodownEntry(godownEntryPoJo,pageNo,pageSize);
        return map;
    }

}
